<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

    <head>
        <title th:text="${pageTitle}"></title>
        <div data-th-replace="layout/head-top"></div>
        <link rel="stylesheet" type="text/css" th:href="@{{path}/common/v3/summernote/summernote-bs3.css?v={v}((path=${staticPath},v=${v})}">
        <style>
            img{
                width: 350px;
                height: 250px;
            }
        </style>
    </head>

    <body class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInLeft">
            <div data-th-replace="common/functionDepict"></div>
            <div>
                <div class="row">
                    <div class="pt10">
                        <div class="col-sm-6">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <h5>问题信息</h5>
                                    <div style="text-align: right"><a href=""><i class="fa fa-refresh"></i> 刷新</a></div>
                                </div>
                                <div class="ibox-content clearfix p-t">
                                    <input type="hidden" id="question-isFree" th:value="${question['isFree']}"/>
                                    <div class="form-horizontal">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">提问人</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static" th:text="${question['user']['nickname']}"></p>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">提问时间</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static" th:text="${#strings.substring(question['createTime'],0,16)}"></p>
                                            </div>
                                        </div>
                                        <!-- 问题价格 开始 -->
                                        <div class="hr-line-dashed" th:if="${question['isFree']} == 2"></div>
                                        <div class="form-group" th:if="${question['isFree']} == 2">
                                            <label class="col-sm-2 control-label">提问消费</label>
                                            <div class="col-sm-10">
                                                <input type="hidden" id="questionPrice" th:value="${question['price']}"/>
                                                <p class="form-control-static"><i class="fa fa-cny" th:text="${question['price']}"></i></p>
                                            </div>
                                        </div>
                                        <!-- 问题价格 开始 -->
                                        <!-- 被问讲师 开始 -->
                                        <div class="hr-line-dashed" th:if="${question['teacherId']}!=0"></div>
                                        <div class="form-group" th:if="${question['teacherId']}!=0">
                                            <label class="col-sm-2 control-label">被问人</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static" th:text="${question['teacherMap']['teacherName']}"></p>
                                            </div>
                                        </div>
                                        <!-- 被问讲师 结束 -->
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">问题详情</label>
                                            <div class="col-sm-10">
                                                <div>
                                                    <div>
                                                        <p class="form-control-static c-999 fs16"><i class="fa fa-question-circle c-999 fs16"></i>&nbsp;<span th:text="${question['context']}"></span></p>
                                                        <div class="photos">
                                                            <img style="width: auto;" class="feed-photo" th:if="!${#arrays.isEmpty(question['imageArr'])}" th:each="image : ${question['imageArr']}" th:src="${image}"/>
                                                        </div>
                                                    </div>
                                                    <div class="m-t">
                                                        <div class="well">
                                                            <p class="form-control-static c-999 fs16"><i class="fa fa-commenting c-999 fs16"></i>&nbsp;回答：</p>
                                                            <div id="question_replyContext" th:utext="${#strings.isEmpty(question['replyContext'])}?'暂无回答':${question['replyContext']}">
                                                                暂无回答
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div th:if="!${#lists.isEmpty(question['qaAddList'])}" th:each="qaAdd:${question['qaAddList']}" class="m-t">
                                                        <span class="text-muted">
                                                            <small class="c-master">[追加提问]</small><span th:text="${qaAdd['createTime']}"></span>
                                                        </span>
                                                        <div class="well">
                                                            <i class="fa fa-question-circle c-999 fs14"></i>&nbsp;
                                                            <span th:text="${qaAdd['addContext']}"></span>
                                                            <br/>
                                                            <div class="m-t">
                                                                <small class="text-muted">
                                                                    <small class="c-master">[追加回答]</small>
                                                                </small>
                                                            </div>
                                                            <div style="text-align: right;">
                                                                <form>
                                                                    <input type="hidden" name="id" th:value="${qaAdd['id']}"/>
                                                                    <textarea class="form-control" style="height: 100px; resize: none;" name="addAnswer" th:disabled="${#strings.isEmpty(qaAdd['addAnswer'])}?false:true " th:text="${qaAdd['addAnswer']}"></textarea>
                                                                    <br/>
                                                                    <div th:if="${#strings.isEmpty(qaAdd['addAnswer'])}">
                                                                        <button class="btn btn-primary ml10 save-questionAdd-addAnswer" type="button">提交追答</button>
                                                                    </div>
                                                                </form>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <th:block th:if="${question['completeStatus']} != 1">
                                <input type="hidden" id="questionId" name="id" th:value="${question['id']}"/>
                                <!--<hr/>-->
                            </th:block>
                            <th:block th:if="${question['completeStatus']} == 1">
                                <div class="ibox float-e-margins">
                                    <form id="replyForm">
                                        <div class="ibox-title">
                                            <h5>回答区</h5>
                                        </div>
                                        <input type="hidden" id="questionId" name="id" th:value="${question['id']}"/>
                                        <input type="hidden" id="completeStatus" name="completeStatus" th:value="${question['completeStatus']}"/>
                                        <div class="ibox-content">
                                            <textarea id="replyContext" name="replyContext" class="form-control" th:text="${question['replyContext']}"></textarea>
                                            <div th:if="${question['completeStatus']} == 1 and (${question['isFree']} == 3 or  ${question['isFree']} == 1 or ${question['isFree']} == 2 and ${isTeacherOfQuestion})" id="btn-div" class="clearfix text-center pt10">
                                                <button id="save-reply" class="btn btn-primary ml10" type="button">保存答案</button>
                                                <button id="save-reply-complete" class="btn btn-danger ml10" type="button">保存并发布答案</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                                <hr/>
                            </th:block>
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <h5 th:if="${question['isFree']} == 1">其他学员评论列表</h5>
                                    <h5 th:if="${question['isFree']} == 2">围观学员回答列表</h5>
                                </div>
                                <div class="ibox-content" id="reply-list-context" style="min-height: 350px">

                                </div>
                            </div>
                            <div id="attend-list-context" style="min-height: 350px">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div data-th-replace="layout/head-footer"></div>
        <script type="text/javascript" th:src="@{{path}/common/summernote/summernote.min.js?v={v}(path=${staticPath},v=${v})}"></script>
        <script type="text/javascript" th:src="@{{path}/common/summernote/summernote-zh-CN.js?v={v}(path=${staticPath},v=${v})}"></script>
        <script type="text/javascript" th:src="@{{path}/admin/business/qa/question/qa-question-info.js?v={v}(path=${staticPath},v=${v})}"></script>
    </body>
</html>